/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Aug 13, 2009 12:49:26 AM $
 *
 * Author: Eric Yang
 * Date  : Aug 13, 2009 12:49:26 AM
 *
 */
package com.gooex.web.action.organization.group;

import java.util.ArrayList;
import java.util.List;

import com.gooex.domain.organization.Group;
import com.gooex.web.action.BaseProtectedAction;


/**
 * @author Eric Yang
 * @version 1.0
 */
public class ListGroup extends BaseProtectedAction {

	public List<Group> getGroups() {
		Group group = sessionContext.getUser().getRole().getGroup();
		if (isSystemObject(group)) {
			return groupManager.getGroups();
		} else if (group.isGrantor()) {
			return group.getSubGroups();
		}
		return new ArrayList<Group>();
	}
}
